/// created by hcl
/// on 2025/5/9
/// FileItemModel
/// desc
class FileItemModel {
  String name = '';
  String path = '';
  bool isDir = false;

  FileItemModel(
    this.name,
    this.path,
    this.isDir,
  );

  FileItemModel.fromMap(Map<String, dynamic> map) {
    name = map['name'] ?? '';
    path = map['path'] ?? '';
    isDir = map['isDir'] ?? false;
  }

  Map<String, dynamic> toMap() {
    Map<String, dynamic> map = {};
    map['name'] = name;
    map['path'] = path;
    map['isDir'] = isDir;
    return map;
  }

  FileItemModel copyWith({
    String? name,
    String? path,
    bool? isDir,
  }) {
    return FileItemModel(
      name ?? this.name,
      path ?? this.path,
      isDir ?? false,
    );
  }

  @override
  String toString() {
    return toMap().toString();
  }
}
